package api

import (
	"blog/common"
	"blog/context"
	"blog/service"
)

func (*APIHander) Login(context *context.MsContext) {
	username := context.GetJson("username").(string)
	passwd := context.GetJson("passwd").(string)
	loginResponse, err := service.Login(username, passwd)
	if err != nil {
		common.Error(context.W, err)
		return
	}
	common.Success(context.W, loginResponse)
}
